const projectName = require('./projects');

// 入口
const pages = {
    index: {
        // entry: `src/projects/${projectName}/src/main.js`,  // 每个子系统单独的main.js和APP.vue
        entry: `src/main.js`,
        template: 'public/index.html',
        filename: 'index.html',
        title: projectName.name
    }
};

// 输出
const outputDir = `dist/${projectName.name}/`

// 代理
const proxy = {
    '/common': {
        target: 'http://118.31.68.71:9913/water-common-all/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
            '^/common': '/'
        }
    },
    '/device': {
        target: 'http://118.31.68.71:9903/water-device/',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
            '^/device': '/'
        }
    }
}

const config = {
    first: {
        pages,
        devServer: {
            port: '8080',
            proxy: proxy
        },
        outputDir
    },
    second: {
        pages,
        devServer: {
            port: '8081',
            proxy: proxy
        },
        outputDir
    }
};

const configObj = config[projectName.name]; //这一部控制导出哪个项目下的配置
module.exports = configObj;
